package sketch.util;

import randoop.util.ReflectionCode;

public final class ReflectionExecutionOutcome {
	
	public final ReflectionCode reflectionCode;
	
	public ReflectionExecutionOutcome(ReflectionCode reflectionCode) {
		Checker.checkNull(reflectionCode, "The reflection code input should not be null.");
		Checker.checkTrue(reflectionCode.hasRunAlready(), "The reflection code should be already run.");
		this.reflectionCode = reflectionCode;
	}
	
	public boolean hasAnyException() {
		return (reflectionCode.getExceptionThrown() != null);
	}
	
	public Object getReturnObject() {
		return reflectionCode.getReturnVariable();
	}
	
	@Override
	public String toString() {
		return reflectionCode.toString();
	}
}